package com.jsgt.greekfire.ui.wallet.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jsgt.greekfire.R

class WalletAdapter : BaseMultiItemQuickAdapter<WalletManageData, BaseViewHolder>() {

    init {
        addItemType(WalletManageData.VIEW_TYPE_MANAGE_TITLE, R.layout.item_manage_wallet_title)
        addItemType(WalletManageData.VIEW_TYPE_WALLET, R.layout.item_manage_wallet)
        addItemType(WalletManageData.VIEW_TYPE_ADD_COIN, R.layout.item_manage_wallet_add_coin)
        addItemType(WalletManageData.VIEW_TYPE_ADD_TITLE, R.layout.item_manage_wallet_import_title)

        addChildClickViewIds(R.id.txvManager)
    }

    override fun convert(holder: BaseViewHolder, item: WalletManageData) {
        if (holder.itemViewType == WalletManageData.VIEW_TYPE_WALLET) {
            holder.setText(R.id.txvName, item.data?.walletName)
                .setText(R.id.txvAddress, item.data?.address)
        }
    }
}